#include <stdbool.h>

#include "driver_system.h"

void system_set_port_pull(uint32_t port_sel, enum system_port_pull_t pull, bool en)
{
    if(en) {
        if(pull == GPIO_PULL_UP) {
            system_regs->port_pull_sel |= port_sel;
        }
        else if(pull == GPIO_PULL_DOWN) {
            system_regs->port_pull_sel &= (~port_sel);
        }
        else {
            return;
        }

        system_regs->port_pull_enable |= port_sel;
    }
    else {
        system_regs->port_pull_enable &= (~port_sel);
    }
}

